package untils

import "dache-server/pkg"

type Sms interface {
	SendSms(mobile string, code string) error
}

// 阿里云短信服务
type AliYun struct {
}

func (y *AliYun) SendSms(mobile string, code string) error {
	sms, err := pkg.ALiYunSms(mobile, code)
	if err != nil {
		return err
	}
	if *sms.Body.Code != "OK" {
		return err
	}
	return nil
}

// 互亿无线SMS
type HuYi struct {
}

func (hy *HuYi) SendSms(mobile string, code string) error {
	sms, err := pkg.ALiYunSms(mobile, code)
	if err != nil {
		return err
	}
	if *sms.Body.Code != "OK" {
		return err
	}
	return nil
}
